/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ftpcombiner.gui.applicationframe;

import ftpcombiner.ApplicationController;
import ftpcombiner.gui.GUILoader;
import ftpcombiner.gui.applicationframe.framesplitter.FileTable;
import ftpcombiner.gui.applicationframe.framesplitter.FileTree;
import ftpcombiner.gui.applicationframe.framesplitter.filetable.FileTableModel;
import java.awt.BorderLayout;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;

/**
 *
 * @author Ben
 */
public class FrameSplitter extends JSplitPane implements GUILoader {

//    private JScrollPane fileTreeScroller;
    private FileTree fileTree;
    private FileTable fileTable;

    private void init() {
        initializeComponents();
        setLayouts();
        addComponents();
        addComponentListeners();
        otherInit();
    }

    public FrameSplitter() {
        init();
    }

    @Override
    public void initializeComponents() {
        //fileTreeScroller = new JScrollPane();
        fileTree = new FileTree();
        fileTable = new FileTable();
    }

    @Override
    public void addComponents() {
        //fileTreeScroller.add(fileTree);
    }

    @Override
    public void addComponentListeners() {
    }

    @Override
    public void otherInit() {
        setOrientation(JSplitPane.HORIZONTAL_SPLIT);
        setLeftComponent(fileTree);
        setRightComponent(fileTable);
        setDividerLocation(200);
        ApplicationController.getSplashScreen().incrementProgress();
    }

    @Override
    public void setLayouts() {
    }

    public void updateFileList() {
        ((FileTableModel) fileTable.getModel()).update();
    }

    public void updateFileList(int index) {
        ((FileTableModel) fileTable.getModel()).update(index);
    }

    public FileTable getFileTable() {
        return fileTable;
    }

    public FileTree getFileTree() {
        return fileTree;
    }
}
